import type { OrderStatus, OrderType } from '@/types/enum'

interface FetchOrderDetailAPIResData {
  code: number
  msg: string
  time: string
  data: {
    id: number
    type: OrderType
    order_number: string
    start_time: string
    start_place: string
    end_place: string
    pay_money: string
    pay_time: string
    order_status: OrderStatus
    order_cannel_time?: string
    cannel_reason?: string
    num: number
    passengers_mobile: string
    passengers_name: string
    pronoun_name: string
    pronoun_mobile: string
    priority_contact: string
    remark?: string
    images?: string
    goods_type?: string
    complete_money?: string
    is_comment: number
    driverid: number
    receive_time?: string
    arrived_time?: string
    finish_time?: string
    username?: string
    mobile?: string
    car_pinpai?: string
    car_num?: string
    avatar?: string
  }
}

interface FetchOrderDetailAPIParams {
  id: string
}

export function fetchOrderDetailAPI(params: FetchOrderDetailAPIParams, token: string) {
  return httpInstance.get<FetchOrderDetailAPIResData, FetchOrderDetailAPIParams>(
    '/api/order/orderdetail',
    { params, headers: { token } },
  )
}
